﻿using System;
using BaseRepository.Redis;
using Microsoft.Extensions.DependencyInjection;

namespace Extensions.Services;

public static class AddRedis1
{
    public static IServiceCollection AddRedisSetup(this IServiceCollection service)
    {
        ArgumentNullException.ThrowIfNull(service);
        // 单例注入redis
        service.AddSingleton(RedisManager.Instance);
        // 注入redis repository
        service.AddSingleton<IRedisRepository, RedisRepository>();
        return service;
    }
}